<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.11.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>cppMISC: include/dcitfc.hpp 源文件</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../cookie.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript" src="../../darkmode_toggle.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">cppMISC<span id="projectnumber">&#160;v1.1</span>
   </div>
   <div id="projectbrief">cppMisc 文档系统</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.11.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(1); });
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('../../',true,false,'search.php','搜索',false);
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="../../dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="headertitle"><div class="title">dcitfc.hpp</div></div>
</div><!--header-->
<div class="contents">
<a href="../../dd/d5a/dcitfc_8hpp.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span><span class="preprocessor">#ifndef DCITFC_HPP</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span><span class="preprocessor">#define DCITFC_HPP</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span> </div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno">   12</span><span class="preprocessor">#include &lt;functional&gt;</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno">   13</span> </div>
<div class="foldopen" id="foldopen00014" data-start="{" data-end="};">
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html">   14</a></span><span class="keyword">struct </span><a class="code hl_struct" href="../../de/d17/structdc_itfc.html">dcItfc</a></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno">   15</span>{</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#a683be737dda8743a4c57330173659558">   16</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#a683be737dda8743a4c57330173659558">connect</a>( <span class="keyword">const</span> std::string&amp; url , <span class="keywordtype">bool</span> bind = <span class="keyword">false</span> ) = 0;</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#a8d3e5af287ee032d94c3206b777762f3">   17</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#a8d3e5af287ee032d94c3206b777762f3">send</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> * data , <span class="keywordtype">size_t</span> len ) = 0;</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#aba834607fa0a5348502faa54c05b6793">   18</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#aba834607fa0a5348502faa54c05b6793">close</a>() = 0;</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#adf293d37a6b5306a9b1cc95efb5703b6">   19</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#adf293d37a6b5306a9b1cc95efb5703b6">onRecv</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> * data , <span class="keywordtype">size_t</span> len ) = 0;</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#a7fecbd0b883d5c80551b15eb4786229e">   20</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#a7fecbd0b883d5c80551b15eb4786229e">onError</a>( <span class="keywordtype">int</span> err ) = 0;</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#acb102933438410297cb1ce2bdb61bf47">   21</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#acb102933438410297cb1ce2bdb61bf47">onConnected</a>() = 0;</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#aedb94ecc6c33b46519041a183100d315">   22</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#aedb94ecc6c33b46519041a183100d315">onDisconnected</a>() = 0;</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#aa4284e7336cd979c61bfc79a72ca90a7">   23</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#aa4284e7336cd979c61bfc79a72ca90a7">onClose</a>() = 0;</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#ac931cf0d15bb515c7abd0b89a2cb9caa">   24</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#ac931cf0d15bb515c7abd0b89a2cb9caa">onSend</a>( <span class="keywordtype">int</span> err ) = 0;</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#a5a455d55880e929db216b77768df9932">   25</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#a5a455d55880e929db216b77768df9932">onClientConnected</a>() = 0;</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno">   26</span> </div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#aab0fbc14cc9a4bc6f503c02e3130da6a">   27</a></span>    <span class="keyword">virtual</span> <span class="keyword">const</span> std::string <a class="code hl_function" href="../../de/d17/structdc_itfc.html#aab0fbc14cc9a4bc6f503c02e3130da6a">type</a>() <span class="keyword">const</span> = 0;</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno">   28</span> </div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#a6a7cb3bcd4319482321107ffb06fef95">   29</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#a6a7cb3bcd4319482321107ffb06fef95">evtError</a>( std::function&lt; <span class="keywordtype">void</span> ( <span class="keywordtype">int</span> err ) &gt; fun ) = 0;</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#afcca8985af3ad66c3cb2dabd265ab66a">   30</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#afcca8985af3ad66c3cb2dabd265ab66a">evtConnected</a>( std::function&lt; <span class="keywordtype">void</span> () &gt; fun ) = 0;</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#ae4bc76c247fe82d026bd886b8922266f">   35</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#ae4bc76c247fe82d026bd886b8922266f">evtClientConnected</a>( std::function&lt; <span class="keywordtype">void</span> (<span class="keyword">const</span> std::string&amp; ) &gt; fun ) = 0;</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#ac5dc97bfbd7470174d41fa37a59e3a2b">   36</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#ac5dc97bfbd7470174d41fa37a59e3a2b">evtClientDisconnected</a>( std::function&lt; <span class="keywordtype">void</span> ( <span class="keyword">const</span> std::string&amp; )&gt; fun ) = 0;</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#aeb25eb4177e4fcf5f71c43557117eed5">   37</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#aeb25eb4177e4fcf5f71c43557117eed5">evtClosed</a>( std::function&lt; <span class="keywordtype">void</span> ( ) &gt; fun ) = 0;</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#a3e26237ed9abb93d34ed1f12f3a81e21">   38</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#a3e26237ed9abb93d34ed1f12f3a81e21">evtRecv</a>( std::function&lt; <span class="keywordtype">void</span> ( <span class="keyword">const</span> <span class="keywordtype">char</span> * data , <span class="keywordtype">size_t</span> len )&gt; fun ) = 0;</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#a79dd374eaaa258ffa03cbb306d3a3de3">   39</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#a79dd374eaaa258ffa03cbb306d3a3de3">evtSend</a>( std::function&lt; <span class="keywordtype">void</span> ( <span class="keywordtype">int</span> err ) &gt; fun ) = 0;</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"><a class="line" href="../../de/d17/structdc_itfc.html#ac0d494c310963f45d061fd7bc52b5bd7">   44</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../de/d17/structdc_itfc.html#ac0d494c310963f45d061fd7bc52b5bd7">evtStop</a>( std::function&lt; <span class="keywordtype">void</span> ()&gt; fun ) = 0;</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span>};</div>
</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span> </div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno">   47</span><span class="preprocessor">#endif </span><span class="comment">// DCITFC_HPP</span></div>
<div class="ttc" id="astructdc_itfc_html"><div class="ttname"><a href="../../de/d17/structdc_itfc.html">dcItfc</a></div><div class="ttdoc">数据通道接口，用来统一数据操作接口。 其中涉及到错误编号的时候，当错误编号小于0的时候是错误编号，等于0的时候是没有发生错误</div><div class="ttdef"><b>定义</b> <a href="#l00014">dcitfc.hpp:15</a></div></div>
<div class="ttc" id="astructdc_itfc_html_a3e26237ed9abb93d34ed1f12f3a81e21"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#a3e26237ed9abb93d34ed1f12f3a81e21">dcItfc::evtRecv</a></div><div class="ttdeci">virtual void evtRecv(std::function&lt; void(const char *data, size_t len)&gt; fun)=0</div></div>
<div class="ttc" id="astructdc_itfc_html_a5a455d55880e929db216b77768df9932"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#a5a455d55880e929db216b77768df9932">dcItfc::onClientConnected</a></div><div class="ttdeci">virtual void onClientConnected()=0</div></div>
<div class="ttc" id="astructdc_itfc_html_a683be737dda8743a4c57330173659558"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#a683be737dda8743a4c57330173659558">dcItfc::connect</a></div><div class="ttdeci">virtual void connect(const std::string &amp;url, bool bind=false)=0</div></div>
<div class="ttc" id="astructdc_itfc_html_a6a7cb3bcd4319482321107ffb06fef95"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#a6a7cb3bcd4319482321107ffb06fef95">dcItfc::evtError</a></div><div class="ttdeci">virtual void evtError(std::function&lt; void(int err) &gt; fun)=0</div></div>
<div class="ttc" id="astructdc_itfc_html_a79dd374eaaa258ffa03cbb306d3a3de3"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#a79dd374eaaa258ffa03cbb306d3a3de3">dcItfc::evtSend</a></div><div class="ttdeci">virtual void evtSend(std::function&lt; void(int err) &gt; fun)=0</div></div>
<div class="ttc" id="astructdc_itfc_html_a7fecbd0b883d5c80551b15eb4786229e"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#a7fecbd0b883d5c80551b15eb4786229e">dcItfc::onError</a></div><div class="ttdeci">virtual void onError(int err)=0</div></div>
<div class="ttc" id="astructdc_itfc_html_a8d3e5af287ee032d94c3206b777762f3"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#a8d3e5af287ee032d94c3206b777762f3">dcItfc::send</a></div><div class="ttdeci">virtual void send(const char *data, size_t len)=0</div></div>
<div class="ttc" id="astructdc_itfc_html_aa4284e7336cd979c61bfc79a72ca90a7"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#aa4284e7336cd979c61bfc79a72ca90a7">dcItfc::onClose</a></div><div class="ttdeci">virtual void onClose()=0</div></div>
<div class="ttc" id="astructdc_itfc_html_aab0fbc14cc9a4bc6f503c02e3130da6a"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#aab0fbc14cc9a4bc6f503c02e3130da6a">dcItfc::type</a></div><div class="ttdeci">virtual const std::string type() const =0</div></div>
<div class="ttc" id="astructdc_itfc_html_aba834607fa0a5348502faa54c05b6793"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#aba834607fa0a5348502faa54c05b6793">dcItfc::close</a></div><div class="ttdeci">virtual void close()=0</div></div>
<div class="ttc" id="astructdc_itfc_html_ac0d494c310963f45d061fd7bc52b5bd7"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#ac0d494c310963f45d061fd7bc52b5bd7">dcItfc::evtStop</a></div><div class="ttdeci">virtual void evtStop(std::function&lt; void()&gt; fun)=0</div><div class="ttdoc">对于服务器有效.用于关闭监听</div></div>
<div class="ttc" id="astructdc_itfc_html_ac5dc97bfbd7470174d41fa37a59e3a2b"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#ac5dc97bfbd7470174d41fa37a59e3a2b">dcItfc::evtClientDisconnected</a></div><div class="ttdeci">virtual void evtClientDisconnected(std::function&lt; void(const std::string &amp;)&gt; fun)=0</div></div>
<div class="ttc" id="astructdc_itfc_html_ac931cf0d15bb515c7abd0b89a2cb9caa"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#ac931cf0d15bb515c7abd0b89a2cb9caa">dcItfc::onSend</a></div><div class="ttdeci">virtual void onSend(int err)=0</div></div>
<div class="ttc" id="astructdc_itfc_html_acb102933438410297cb1ce2bdb61bf47"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#acb102933438410297cb1ce2bdb61bf47">dcItfc::onConnected</a></div><div class="ttdeci">virtual void onConnected()=0</div></div>
<div class="ttc" id="astructdc_itfc_html_adf293d37a6b5306a9b1cc95efb5703b6"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#adf293d37a6b5306a9b1cc95efb5703b6">dcItfc::onRecv</a></div><div class="ttdeci">virtual void onRecv(const char *data, size_t len)=0</div></div>
<div class="ttc" id="astructdc_itfc_html_ae4bc76c247fe82d026bd886b8922266f"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#ae4bc76c247fe82d026bd886b8922266f">dcItfc::evtClientConnected</a></div><div class="ttdeci">virtual void evtClientConnected(std::function&lt; void(const std::string &amp;) &gt; fun)=0</div><div class="ttdoc">对于服务器有效</div></div>
<div class="ttc" id="astructdc_itfc_html_aeb25eb4177e4fcf5f71c43557117eed5"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#aeb25eb4177e4fcf5f71c43557117eed5">dcItfc::evtClosed</a></div><div class="ttdeci">virtual void evtClosed(std::function&lt; void() &gt; fun)=0</div></div>
<div class="ttc" id="astructdc_itfc_html_aedb94ecc6c33b46519041a183100d315"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#aedb94ecc6c33b46519041a183100d315">dcItfc::onDisconnected</a></div><div class="ttdeci">virtual void onDisconnected()=0</div></div>
<div class="ttc" id="astructdc_itfc_html_afcca8985af3ad66c3cb2dabd265ab66a"><div class="ttname"><a href="../../de/d17/structdc_itfc.html#afcca8985af3ad66c3cb2dabd265ab66a">dcItfc::evtConnected</a></div><div class="ttdeci">virtual void evtConnected(std::function&lt; void() &gt; fun)=0</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.11.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
